import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-10-12
 * Time:9:53
 */
class Student{
    private String name;
    private int age;
    private double score;

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }
}

public class Test {
    public static void main(String[] args) {
        String str1=new String("hel");
        String str2=new String("hello world");
        ArrayList<Character> arrayList=new ArrayList<>();
        for (int i = 0; i < str2.length(); i++) {
            if(!str1.contains(str2.charAt(i)+"")){
                arrayList.add(str2.charAt(i));
            }
        }
        for (int i = 0; i < arrayList.size(); i++) {
            System.out.print(arrayList.get(i));
        }
    }
    public static void main3(String[] args) {
        ArrayList<Student> arrayList=new ArrayList<>();
        arrayList.add(new Student("sad",12,90.0));
        arrayList.add(new Student("dsa",12,91.0));
        arrayList.add(new Student("ads",12,92.0));
        Iterator<Student> it=arrayList.listIterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
    }
    public static void main2(String[] args) {
        ArrayList<Integer> arrayList=new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        //取值还是从上一个数组中得到的，不是新创建的对象
        List<Integer> ret=arrayList.subList(1,3);
        Iterator<Integer> it=arrayList.listIterator();
        System.out.println(ret);
        arrayList.listIterator();
        //remove
        //删除内容
        arrayList.remove(Integer.valueOf(2));
        //删除下标位置的内容
        arrayList.remove(2);
        //迭代器的删除

    }
    public static void main1(String[] args) {
        //顺序表
        ArrayList<Integer> arrayList=new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        Iterator<Integer> it=arrayList.iterator();
        while (it.hasNext()){
            System.out.print(it.next()+" ");
        }
    }
}
